import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'entity.dart';
import 'dart:convert';

main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "11",
      home: Scaffold(
        appBar: AppBar(
          title: Text("json测试"),
        ),
        body: RaisedButton(onPressed: _onPress,child: Text("aaa"),),
      ),
    );
  }

  void _onPress() {
//    print(Entity("aaa").toJson());
    String _json = json.encode(Entity("aaa"));
    print(_json);
    Entity _jsonE= Entity.fromJson(json.decode("""{"name":"11"}"""));
    print(_jsonE.name);
  }
}
